package com.tao.spell.group.controller;

import com.tao.spell.common.utils.PageUtils;
import com.tao.spell.common.utils.R;
import com.tao.spell.group.entity.PintuanEntity;
import com.tao.spell.group.service.PintuanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 * 
 *
 * @author lc
 * @email sunlightcs@gmail.com
 * @date 2021-09-10 20:29:10
 */
@RestController
@RequestMapping("group/pintuan")
public class PintuanController {
    @Autowired
    private PintuanService pintuanService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = pintuanService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{pintuanId}")

    public R info(@PathVariable("pintuanId") Integer pintuanId){
		PintuanEntity pintuan = pintuanService.getById(pintuanId);

        return R.ok().put("pintuan", pintuan);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody PintuanEntity pintuan){
		pintuanService.save(pintuan);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")

    public R update(@RequestBody PintuanEntity pintuan){
		pintuanService.updateById(pintuan);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")

    public R delete(@RequestBody Integer[] pintuanIds){
		pintuanService.removeByIds(Arrays.asList(pintuanIds));

        return R.ok();
    }

}
